home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / CIncludes / strstream.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-04  |  2.7 KB  |  124 lines  |  [TEXT/MPS ]

  1. /*
  2.  *------------------------------------------------------------------------
  3.  * Copyright:
  4.  *      © 1993 by Apple Computer Inc.  all rights reserved.
  5.  *
  6.  * Project:
  7.  *      PowerPC C++ Streams Library
  8.  *
  9.  * Filename:
  10.  *      strstream.h
  11.  *
  12.  * Created:
  13.  *      (unknown)
  14.  *
  15.  * Modified:
  16.  *      Date     Engineer       Comment
  17.  *      -------- -------------- ------------------------------------------
  18.  *      12/17/93 Rudy Wang      Made this file universal.
  19.  *------------------------------------------------------------------------
  20.  */
  21. #ifndef __STRSTREAMH__
  22. #define __STRSTREAMH__      1
  23.  
  24. #include <iostream.h>
  25.  
  26. #ifdef powerc
  27. #pragma options align=power
  28. #endif
  29.  
  30. class strstreambuf : public streambuf
  31. {
  32.  
  33. public:
  34.                 strstreambuf();
  35.                 strstreambuf(int);
  36.                 strstreambuf(void* (*a)(long), void (*f)(void*));
  37.                 strstreambuf(char* b, int size, char* pstart = 0);
  38.                 strstreambuf(unsigned char* b, int size, unsigned char* pstart = 0);
  39.                 ~strstreambuf();
  40.     int         pcount();
  41.     void        freeze(int n = 1);
  42.     char*       str();
  43.  
  44. public:
  45.     virtual int         doallocate();
  46.     virtual int         overflow(int);
  47.     virtual int         underflow();
  48.     virtual streambuf*  setbuf(char* p, int l);
  49.     virtual streampos   seekoff(streamoff, ios::seek_dir, int);
  50.  
  51. private:
  52.     void        init(char*, int, char*);
  53.     void*       (*afct)(long);
  54.     void        (*ffct)(void*);
  55.     int         ignore_oflow;
  56.     int         froozen;
  57.     int         auto_extend;
  58.  
  59. #ifdef powerc
  60. public:
  61.     int         isfrozen()              { return froozen; }
  62. #endif
  63.  
  64. };  // class strstreambuf
  65.  
  66.  
  67. class strstreambase : public virtual ios
  68. {
  69.  
  70. public:
  71.                 strstreambuf* rdbuf();
  72.  
  73. protected:
  74.                 strstreambase(char*, int, char*);
  75.                 strstreambase();
  76.                 ~strstreambase();
  77.  
  78. private:
  79.     strstreambuf buf;
  80.  
  81. };  // class strstreambase
  82.  
  83.  
  84. class istrstream : public strstreambase, public istream
  85. {
  86.  
  87. public:
  88.                 istrstream(char* str);
  89.                 istrstream(char* str, int size);
  90.                 ~istrstream();
  91.  
  92. };  // class istrstream
  93.  
  94.  
  95. class ostrstream : public strstreambase, public ostream
  96. {
  97.  
  98. public:
  99.                 ostrstream(char* str, int size, int mode = ios::out);
  100.                 ostrstream();
  101.                 ~ostrstream();
  102.     char*       str();
  103.     int         pcount();
  104.  
  105. };  // class ostrstream
  106.  
  107.  
  108. class strstream : public strstreambase, public iostream
  109. {
  110.  
  111. public:
  112.                 strstream();
  113.                 strstream(char* str, int size, int mode);
  114.                 ~strstream();
  115.     char*       str();
  116.  
  117. };  // class strstream
  118.  
  119. #ifdef powerc
  120. #pragma options align=reset
  121. #endif
  122.  
  123. #endif
  124.